package com.yourenbang.lingyun.transaction.web.controller.manage;

import com.yourenbang.lingyun.core.base.interceptor.ExcludeInterceptor;
import com.yourenbang.lingyun.core.message.Result;
import com.yourenbang.lingyun.core.util.KLog;
import com.yourenbang.lingyun.transaction.web.domain.dto.fund.AllyTicketBackstageDTO;
import com.yourenbang.lingyun.transaction.web.domain.dto.fund.DetailTicketDTO;
import com.yourenbang.lingyun.transaction.web.service.ticket.TicketAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/transaction/manage")
public class ManageTicketAccountController {

    @Autowired
    private TicketAccountService ticketAccountService;

    /**
     * 银小云兑换券后台查询
     */
    @ExcludeInterceptor
    @PostMapping(value = "/ticket/account")
    public Result allyTicketYxyBackstage(@RequestBody AllyTicketBackstageDTO dto) {
        KLog.info("[银小云兑换券账户查询入参]:{}", dto);
        return ticketAccountService.allyTicketYxyBackstage(dto);
    }

    /**
     * 银小云兑换券明细后台查询
     */
    @ExcludeInterceptor
    @PostMapping(value = "/ticket/journal")
    public Result detailTicketYxy(@RequestBody DetailTicketDTO dto) {
        KLog.info("[银小云兑换券账单明细入参]:{}", dto);
        Result result = ticketAccountService.manageDetailTicketYxy(dto);
        return result;
    }

    /**
     * 考拉快收兑换券后台查询
     * @see <a href="https://huoyan.kaolakuaishou.cn/project/97/interface/api/13446">火眼接口连接</a>
     */
    @ExcludeInterceptor
    @PostMapping(value = "/ticket/account/klks")
    public Result allyTicketKlksBackstage(@RequestBody AllyTicketBackstageDTO dto) {

        KLog.info("[考拉快收兑换券账户查询入参]:{}", dto);
        return ticketAccountService.allyTicketKlksBackstage(dto);
    }

    /**
     * 考拉快收兑换券明细后台查询
     * @see <a href="https://huoyan.kaolakuaishou.cn/project/97/interface/api/13449">火眼接口连接</a>
     */
    @ExcludeInterceptor
    @PostMapping(value = "/ticket/journal/klks")
    public Result detailTicketKlks(@RequestBody DetailTicketDTO dto) {

        KLog.info("[考拉快收兑换券账单明细入参]:{}", dto);
        return ticketAccountService.manageDetailTicketKlks(dto);
    }
}
